/**
 * <p>
 * 表格配置
 *
 * @Author：Roy
 * @Description：碳排放规划配置
 * @Date：Create by 2024-01-11 16:45:38
 */
// 隐藏操作按钮的规则配置，字段名：isEdit
const isHidden = (list, row) => {
  const { isEdit } = row || {}
  return list.includes(String(isEdit))
}

const headerConfig = {
  'carbon-emission-plan-1': [
    {
      prop: 'projectName',
      name: '所属项目',
      minWidth: 110
    },
    {
      prop: 'edificeName',
      name: '所属楼栋',
      minWidth: 110
    },
    {
      prop: 'carbonEmission',
      name: '规划碳排(kgCO2)',
      minWidth: 110
    },
    {
      prop: 'effectiveTimeStart',
      mergeProp: 'effectiveTimeEnd',
      mergeIcon: '-',
      name: '生效时间范围',
      minWidth: 220
    },
    {
      name: '操作',
      width: 200,
      fixed: 'right',
      thStyle: { 'text-align': 'left' },
      operateList: [
        {
          type: 'btnText',
          label: '详情',
          id: 'carbon-emission-plan-detail',
          authId: 'ecp-admin:carbonEmissionPlan:update',
          config: { type: 'text' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        },
        {
          type: 'btnText',
          label: '编辑',
          id: 'carbon-emission-plan-edit',
          authId: 'ecp-admin:carbonEmissionPlan:update',
          config: { type: 'text' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        },
        {
          type: 'btnText',
          label: '复制',
          id: 'carbon-emission-plan-add',
          authId: 'ecp-admin:carbonEmissionPlan:update',
          config: { type: 'text' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        },
        {
          type: 'btnText',
          label: '删除',
          id: 'carbon-emission-plan-delete',
          authId: 'ecp-admin:carbonEmissionPlan:deleteById',
          isMore: true,
          config: { type: 'text' },
          style: { color: '#ff0000' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        }
      ]
    }
  ],
  'carbon-emission-plan-2': [
    {
      prop: 'projectName',
      name: '所属项目',
      minWidth: 110
    },
    {
      prop: 'edificeName',
      name: '所属楼栋',
      minWidth: 110
    },
    {
      prop: 'effectiveTimeStart',
      name: '未规划日期',
      minWidth: 110
    },
    {
      name: '操作',
      width: 200,
      fixed: 'right',
      thStyle: { 'text-align': 'left' },
      operateList: [
        {
          type: 'btnText',
          label: '配置',
          id: 'carbon-emission-plan-edit',
          authId: 'ecp-admin:carbonEmissionPlan:update',
          config: { type: 'text' },
          hidden: (val) => {
            return false
          }
        }
      ]
    }
  ]
}

export default {}
export { headerConfig }
